<template>
  <view>
    <view class="form_bottom_btn">
      <view class="btn-box">
        <view
          v-for="(item, index) in dataConfig"
          :key="index"
          :class="item.class"
          @click="clickBtnItem(item)"
        >{{ item.text }}</view>
      </view>
    </view>
  </view>
</template>

<script>
  export default {
    name: 'YouBottomBtn',
    data() {
      return {
        dataConfig: []
      }
    },
    props: {
      btnConfig: {
        type: Array,
        default: []
      }
    },
    watch: {
      btnConfig: {
        handler(newVal, oldVal) {
          this.dataConfig = uni.$u.deepClone(newVal)
        }
      }
    },

    created() {
      this.dataConfig = uni.$u.deepClone(this.btnConfig)
    },

    methods: {
      clickBtnItem(item) {
        this.$emit(item.funcName)
      }
    }
  }
</script>